package com.example.fang.demodruid.concurrency7;

public class MyTest4 {

    public static void main(String[] args) {
        MyTest mytask=new MyTest();
        Runnable runnable=()->{
            mytask.hello();
            System.out.println("当前线程名称1"+Thread.currentThread().getName());
        };
        Thread thread=new Thread(runnable);
        thread.start();

        Runnable runnable1=()->{
            mytask.hello();
            System.out.println("当前线程名称2"+Thread.currentThread().getName());
        };
        Thread thread1=new Thread(runnable1);
        thread1.start();
    }
}

class  MyTest{
    void hello(){
        System.out.println("我来执行了"+Thread.currentThread().getName());
        System.out.println("我来执行了");
    }
}
